package com.aner.test.controller;
import com.aner.tester.controller.BaseControllerTest;
import org.junit.Test;
import org.junit.runner.RunWith;
import com.aner.tester.utils.text.StringUtils;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;


/**
 * DeleteTestControllerTest class
 * 
 * @author aner
 * @date 2020-12-27
 */
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@RunWith(SpringRunner.class)
@AutoConfigureMockMvc
public class DeleteTestControllerTest extends BaseControllerTest
{

    @Test
    public void testTest() {
        String params = "{'booleanTest':false,'byteTest':0,'dateTest':'2020-12-27 21:28:36','doubleTest':0.7927824284955497,'floatTest':0.7486492,'intTest':0,'longTest':2,'stringTest':'的1'}";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.delete("/test/", jsonStr);
        
    }
    @Test
    public void testRequestBodyMapTest() {
        String params = "{'省小省三4':'631339','的告广告告1':'7715','狗的小':'33112'}";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.deleteBody("/testRequestBodyMap/", jsonStr);
        
    }
    @Test
    public void testRequestBodyListTest() {
        String params = "['小四狗的狗司','故告公个']";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.deleteBody("/testRequestBodyList/", jsonStr);
        
    }
    @Test
    public void testRequestBodyLongTest() {
        String params = "3";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.deleteBody("/testRequestBodyLong/", jsonStr);
        
    }
    @Test
    public void testRequestParamListTest() {
        String params = "{'testList':['0猪事','四5猫四四','安的4个小']}";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.delete("/testRequestParamList/", jsonStr);
        
    }
    @Test
    public void testRequestParamDateTest() {
        String params = "{'testDate':'2020-12-27 21:28:36'}";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.delete("/testRequestParamDate/", jsonStr);
        
    }
    @Test
    public void testRequestBodyDateTest() {
        String params = "1609075716177";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.deleteBody("/testRequestBodyDate/", jsonStr);
        
    }
    @Test
    public void testDateTest() {
        String params = "{'test':'2020-12-27 21:28:36'}";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.delete("/testDate/", jsonStr);
        
    }
    @Test
    public void testBodyTest() {
        String params = "{'booleanTest':false,'byteTest':1,'dateTest':'2020-12-27 21:28:36','doubleTest':0.6550726408982765,'floatTest':0.5238237,'intTest':0,'longTest':3,'strArray':['四1','东03的广'],'stringList':['东广小尔','安小','四2小告广','2小省尔4','小1告猪广4','告4广的3'],'stringTest':'公的4','testObjectArray':[{'booleanTest':false,'byteTest':0,'dateTest':'2020-12-27 21:28:36','doubleTest':0.36685498303594244,'floatTest':0.7150227,'intTest':1,'longTest':3,'stringTest':'事个小小'},{'booleanTest':true,'byteTest':0,'dateTest':'2020-12-27 21:28:36','doubleTest':0.07814914987041022,'floatTest':0.6784829,'intTest':0,'longTest':1,'stringTest':'小猪'}],'testObjectList':[{'booleanTest':false,'byteTest':1,'dateTest':'2020-12-27 21:28:36','doubleTest':0.6238646695677408,'floatTest':0.108054996,'intTest':1,'longTest':2,'stringTest':'广狗小三公小'},{'booleanTest':true,'byteTest':1,'dateTest':'2020-12-27 21:28:36','doubleTest':0.8789089612283493,'floatTest':0.2847336,'intTest':0,'longTest':0,'stringTest':'三狗猪'}],'testObjectMap':{'4东2小3故':'16','小小小04事':'700','小第广':'99933','4小':'668352','猪5狗':'276195'}}";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.deleteBody("/testRequestBody/", jsonStr);
        
    }
    @Test
    public void testPathVariableTest() {
        String params = "{'params':['14小猪1','东狗的公0','猪猫的三小','小小告安','小小小广小1'],'id':[1,3,2]}";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.delete("/testPathVariable/{params}/{id}", jsonStr);
        
    }
}
